package com.avalon.erp.sys.addon.base.service;

import com.avalon.core.field.Field;
import com.avalon.core.field.Fields;
import com.avalon.core.service.AbstractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class FieldService extends AbstractService {
    @Override
    public String getServiceName() {
        return "base.field";
    }

    private final Field label = Fields.createString("字段名");
    private final Field isPrimaryKey = Fields.createBoolean("主键");
    private final Field isAutoIncrement = Fields.createBoolean("自增");
    private final Field isRequired = Fields.createBoolean("必填");
    private final Field isReadonly = Fields.createBoolean("只读");
    private final Field defaultValue = Fields.createString("默认值");
    private final Field fieldType = Fields.createFieldSelectionField();
    private final Field serviceId = Fields.createMany2one("服务", "base.service");
    private final Field isUnique = Fields.createBoolean("唯一");
    private final Field allowNull = Fields.createBoolean("允许空");
    private final Field maxLength = Fields.createInteger("最大长度");
    private final Field minLength = Fields.createInteger("最小长度");
    private final Field minValue = Fields.createBigDecimal("最小值", 50, 6);
    private final Field maxValue = Fields.createBigDecimal("最大值", 50, 6);
}
